<template>
	<div class="style_detail">
					
		<el-form ref="form" :model="form" label-width="160px" style="width:100%;">
		 <el-row class="good_detail">
			 			 
			 <div class="canEdit">
			 	<el-form-item label="Contact" >
			 		<el-col :span="11">
					   <el-select v-model="goods.contact" placeholder="Please choose" >
							  <el-option v-for="(item, index) in ContactList" :key="index" :label="item.ContactName" :value="item.CompanyContactID"></el-option>
					    </el-select>
				    </el-col> 
				 </el-form-item>
				 
				 <el-form-item label="RequestDate" >
			 		<el-date-picker
				      v-model="value1"
				      type="date"
				      placeholder="Select date">
				    </el-date-picker>
				 </el-form-item>
				 
				<!-- <el-form-item label="goods.SalesRep" class="item-detail">
			 		<el-col :span="11">
					   <el-select v-model="SalesRep" placeholder="Please choose" >
							  <el-option v-for="(item, index) in SalesRepList" :key="index" :label="item.CountryName" :value="item.CountryID"></el-option>
					    </el-select>
				    </el-col> 
				 </el-form-item> -->
				 
				 <el-form-item label="Part" >
			 		<el-col :span="11">
					   <el-select v-model="goods.Part" placeholder="Please choose" >
							  <el-option v-for="(item, index) in PartList" :key="index" :label="item.BrandName" :value="item.BrandID"></el-option>
					    </el-select>
					     <el-input v-model="goods.PartNo1"  style="clear: left;display:inline;"></el-input>
				    </el-col> 
				   
				 </el-form-item>
				 
				 <el-form-item label="Customer PartNo">
				   <el-input v-model="goods.PartNo"  ></el-input>
				 </el-form-item>
				 <el-form-item label="Target Price" class="item-detail">
				   <el-input v-model="goods.TargetPrice" ></el-input>
				 </el-form-item>
				  <el-form-item label="Quanitity" class="item-detail">
				   <el-input v-model="goods.Quanitity" ></el-input>
				 </el-form-item>
				 <el-form-item label="DateCode" class="item-detail" style="clear: left;">
				   <el-input v-model="goods.DateCode"  ></el-input>
				 </el-form-item>
				 <el-form-item label="Package"  class="item-detail" >
				   <el-input v-model="goods.Package"  ></el-input>
				 </el-form-item>
				
				<el-form-item label="LeadFree" style="clear: left;">
			 		<el-col :span="11">
					   <el-select v-model="goods.LeadFree" placeholder="Please choose" >
							  <el-option v-for="(item, index) in LeadFreeList" :key="index" :label="item.CountryName" :value="item.CountryID"></el-option>
					    </el-select>
				    </el-col> 
				 </el-form-item>
				
				 <el-form-item label="Remarks" >
				    <el-input type="textarea"  :autosize="{ minRows: 2, maxRows: 4}" v-model="goods.Remarks"></el-input>
				 </el-form-item>
				 
			 </div>
			  
		  </el-row>
		  
		  <el-form-item class="submit">
		    <el-button type="primary" @click="onSubmit">Save</el-button>
		    <el-button >Cancel</el-button>
		  </el-form-item>
		</el-form>	

		  
	</div>
</template>

<script type="text/javascript">
	import E from 'wangeditor'
	import 'wangeditor/release/wangEditor.min.css'
	export default{
		data(){
			return{
				max:20,
				form: {
			          name: '',
			          region: '',
			          date1: '',
			          date2: '',
			          delivery: false,
			          type: [],
			          resource: '',
			          desc: '',
			          
			          value1: '',
			        },
				goods:{},
				value1: '',
				dialogImageUrl: '',
				dialogVisible: false,
				currentdata:[],
				LeadFreeList:[],
				PartList:[],
				ContactList:[],
				
				
			}
		},
		mounted () {


	    },
		created(){
			this.getContactList();
			this.getPartList();
		},
		methods:{
		
			 onSubmit() {
					axios.post('/api/style/edit', {
						  
						  })
						  .then(res => {
							if(res.data.code ==200){
								this.$notify({
								  title: 'Success',
								  message: res.data.message,
								  type: 'success'
								});
							}
						  	
						  })
						  .catch(error => {
							  this.$notify.error({
							    title: 'Error',
							    message: error.data.message,
							  });
						  })
			      },
			      
	      getContactList(){
	      var CompanyID =this.$route.query.CompanyID; 
	      	axios.get('/api/customer/contacts?CompanyID='+CompanyID).then(result => {
					this.ContactList = result.data.result;
				});
	      },
	      
	      getPartList(){
	      	axios.get('/api/brand').then(result => {
					this.PartList = result.data.result;
				});
	      },
		
		handleRemove(file, fileList) {
			axios.post('/api/base/delImage',file)
					.then(result => {
						this.img_url_1 = fileList;
					})
					.catch(error => {
					});
		},
		handlePreview(file) {
			//console.log(this.goods.detailPic);
		},
		handlePictureCardPreview(file) {
			this.dialogImageUrl = file.url;
			this.dialogVisible = true;
		},
		handleExceed(files, fileList) {
			this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
		},
		beforeRemove(file, fileList) {
			return this.$confirm(`确定移除 ${file.name}？`);
		},
		successEvent(file){
		    	this.img_url_1.push({name:file.result,url:file.result});
		    },
		handleClose(obj) {
			this.dialogVisible = false;
		},
		filterMethod(query, item) {
			return item;
		}
			
		}
	}
</script>

<style lang="scss" >
	
	
</style>